// Spring.h: interface for the Spring class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SPRING_H__3D97228B_3719_47DD_A493_74E263B3C01D__INCLUDED_)
#define AFX_SPRING_H__3D97228B_3719_47DD_A493_74E263B3C01D__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class AFX_EXT_CLASS Spring  
{
public:
	Spring();
	virtual ~Spring();

public:
	BOOL IsLegal(DOUBLE dbWorkLoad, DOUBLE LoadChangeCoefficient, DOUBLE dbDisplacement);

public:
	void SpringSerialNum(INT nSpringSerialNum){
		m_nSpringSerialNum = nSpringSerialNum;
	}

	INT SpringSerialNum(){
		return m_nSpringSerialNum;
	}

	void PreReduceValue(DOUBLE dbPreReduceValue){
		m_dbPreReduceValue = dbPreReduceValue;
	}

	DOUBLE PreReduceValue(){
		return m_dbPreReduceValue;
	}

	void Journey(DOUBLE dbJourney){
		m_dbJourney = dbJourney;
	}

	DOUBLE Journey(){
		return m_dbJourney*m_nSpringSerialNum;
	}

	void MinPress(DOUBLE dbPress){
		m_dbMinPress = dbPress;
	}

	DOUBLE MinPress(){
		return m_dbMinPress;
	}

	void MaxPress(DOUBLE dbPress){
		m_dbMaxPress = dbPress;
	}

	DOUBLE MaxPress(){
		return m_dbMaxPress;
	}

	DOUBLE SpringCoefficient(){
		m_dbSpringCoefficient = (m_dbMaxPress - m_dbMinPress)/Journey();
		return m_dbSpringCoefficient;
	}

	void StandardID(const CString& strStandardID){
		m_strStandardID = strStandardID;
	}

	const CString& StandardID(){
		return m_strStandardID;
	}

	void Number(INT nNum){
		m_nNum = nNum;
	}

	INT Number(){
		return m_nNum;
	}

private:
	DOUBLE GetSpringDisplacement(DOUBLE dbWorkLoad);
	DOUBLE GetLoadChangeCoefficient(DOUBLE dbDisplacement, DOUBLE dbWorkLoad);

private:
	INT m_nSpringSerialNum;
	DOUBLE m_dbPreReduceValue;
	DOUBLE m_dbJourney;
	DOUBLE m_dbMinPress;
	DOUBLE m_dbMaxPress;
	DOUBLE m_dbSpringCoefficient;
	INT m_nNum;
	CString m_strStandardID;
};

#endif // !defined(AFX_SPRING_H__3D97228B_3719_47DD_A493_74E263B3C01D__INCLUDED_)
